package com.haochen.consumer.auth.service;


import com.haochen.common.exception.SystemException;
import com.haochen.consumer.auth.dto.InterUserDto;
import com.haochen.consumer.auth.dto.UpdateUserDto;
import com.haochen.consumer.auth.dto.UserInfoOutputBean;
import com.haochen.consumer.auth.entity.MstInterUserBaseEntity;
import com.haochen.consumer.auth.entity.MstInterUserDtlEntity;
import com.haochen.consumer.auth.entity.TranInterUserTokenEntity;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

/**
 * @author YangChao
 */
@FeignClient(value = "management-provider", path = "user")
public interface MstInterUserBaseService {

    @PostMapping(value = "/findByCode")
    MstInterUserBaseEntity findByCode(@RequestParam("userCode") String userCode);

    @PostMapping(value = "/findByUsername")
    MstInterUserBaseEntity findByUsername(@RequestParam("userName") String userName);

    @PostMapping(value = "/findPage")
    List<InterUserDto> findPage(Map<String, Object> paramMap);

    @PostMapping(value = "/count")
    Integer count(Map<String, Object> paramMap);

    @PostMapping(value = "/createUser")
    void createUser(@RequestBody UpdateUserDto user);

    @PostMapping(value = "/updateUser")
    void updateUser(MstInterUserBaseEntity user) throws SystemException;

    @PostMapping(value = "/deleteUser")
    void deleteUser(String interUserCode);

    @PostMapping(value = "/findBySubsyCodes")
    List<MstInterUserBaseEntity> findBySubsyCodes(@RequestParam("subsyCodes") String subsyCodes);

    @PostMapping(value = "/findDtlByUserCode")
    MstInterUserDtlEntity findDtlByUserCode(@RequestParam("userCode") String userCode);

    @PostMapping(value = "/findRoleCodeByUserCode")
    List<String> findRoleCodeByUserCode(@RequestParam("userCode") String userCode);

    @GetMapping(value = "/getUserInfo")
    UserInfoOutputBean getUserInfo(@RequestParam("userName") String userName);

    @PostMapping(value = "/updateJwtToken")
    void updateJwtToken(@RequestBody TranInterUserTokenEntity tranInterUserTokenEntity);

    @GetMapping(value = "/checkJwtToken")
    Integer checkJwtToken(@RequestParam("token") String token);
}
